package com.tt.dp.command;

import com.tt.dp.command.model.CeilingFan;

public abstract class AbsCeilingFanCommand implements Command{

    protected CeilingFan ceilingFan;

    protected int prevSpeed;

    public void undo() {

        switch (this.prevSpeed) {
            case CeilingFan.HIGH:
                this.ceilingFan.high();
                break;
            case CeilingFan.MEDIUM:
                this.ceilingFan.medium();
                break;
            case CeilingFan.LOW:
                this.ceilingFan.low();
                break;
            case CeilingFan.OFF:
                this.ceilingFan.off();
                break;
            default:
                break;
        }
    }
}
